Optimal. Leaf size=240 \[ -\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A-4 a b B+4 A b^2\right ) \sin (c+d x) \cos (c+d x)}{8 a^3 d}-\frac{2 b^4 (A b-a B) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 d \sqrt{a-b} \sqrt{a+b}}+\frac{x \left (4 a^2 A b^2+3 a^4 A-4 a^3 b B-8 a b^3 B+8 A b^4\right )}{8 a^5}-\frac{(A b-a B) \sin (c+d x) \cos ^2(c+d x)}{3 a^2 d}+\frac{A \sin (c+d x) \cos ^3(c+d x)}{4 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.982321, antiderivative size = 240, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.194, Rules used = {4034, 4104, 3919, 3831, 2659, 208} \[ -\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A-4 a b B+4 A b^2\right ) \sin (c+d x) \cos (c+d x)}{8 a^3 d}-\frac{2 b^4 (A b-a B) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 d \sqrt{a-b} \sqrt{a+b}}+\frac{x \left (4 a^2 A b^2+3 a^4 A-4 a^3 b B-8 a b^3 B+8 A b^4\right )}{8 a^5}-\frac{(A b-a B) \sin (c+d x) \cos ^2(c+d x)}{3 a^2 d}+\frac{A \sin (c+d x) \cos ^3(c+d x)}{4 a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4034
Rule 4104
Rule 3919
Rule 3831
Rule 2659
Rule 208
Rubi steps
\begin{align*} \int \frac{\cos ^4(c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx &=\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac{\int \frac{\cos ^3(c+d x) \left (4 (A b-a B)-3 a A \sec (c+d x)-3 A b \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{4 a}\\ &=-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac{\int \frac{\cos ^2(c+d x) \left (3 \left (3 a^2 A+4 b (A b-a B)\right )+a (A b+8 a B) \sec (c+d x)-8 b (A b-a B) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{12 a^2}\\ &=\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac{\int \frac{\cos (c+d x) \left (8 \left (2 a^2+3 b^2\right ) (A b-a B)-a \left (9 a^2 A-4 A b^2+4 a b B\right ) \sec (c+d x)-3 b \left (3 a^2 A+4 A b^2-4 a b B\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{24 a^3}\\ &=-\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac{\int \frac{3 \left (3 a^4 A+4 a^2 A b^2+8 A b^4-4 a^3 b B-8 a b^3 B\right )+3 a b \left (3 a^2 A+4 A b^2-4 a b B\right ) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{24 a^4}\\ &=\frac{\left (3 a^4 A+4 a^2 A b^2+8 A b^4-4 a^3 b B-8 a b^3 B\right ) x}{8 a^5}-\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac{\left (b^4 (A b-a B)\right ) \int \frac{\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^5}\\ &=\frac{\left (3 a^4 A+4 a^2 A b^2+8 A b^4-4 a^3 b B-8 a b^3 B\right ) x}{8 a^5}-\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac{\left (b^3 (A b-a B)\right ) \int \frac{1}{1+\frac{a \cos (c+d x)}{b}} \, dx}{a^5}\\ &=\frac{\left (3 a^4 A+4 a^2 A b^2+8 A b^4-4 a^3 b B-8 a b^3 B\right ) x}{8 a^5}-\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac{\left (2 b^3 (A b-a B)\right ) \operatorname{Subst}\left (\int \frac{1}{1+\frac{a}{b}+\left (1-\frac{a}{b}\right ) x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{a^5 d}\\ &=\frac{\left (3 a^4 A+4 a^2 A b^2+8 A b^4-4 a^3 b B-8 a b^3 B\right ) x}{8 a^5}-\frac{2 b^4 (A b-a B) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 \sqrt{a-b} \sqrt{a+b} d}-\frac{\left (2 a^2+3 b^2\right ) (A b-a B) \sin (c+d x)}{3 a^4 d}+\frac{\left (3 a^2 A+4 A b^2-4 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac{(A b-a B) \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac{A \cos ^3(c+d x) \sin (c+d x)}{4 a d}\\ \end{align*}
Mathematica [A] time = 0.639956, size = 202, normalized size = 0.84 \[ \frac{12 (c+d x) \left (4 a^2 A b^2+3 a^4 A-4 a^3 b B-8 a b^3 B+8 A b^4\right )+24 a^2 \left (a^2 A-a b B+A b^2\right ) \sin (2 (c+d x))+24 a \left (3 a^2+4 b^2\right ) (a B-A b) \sin (c+d x)+\frac{192 b^4 (A b-a B) \tanh ^{-1}\left (\frac{(b-a) \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a^2-b^2}}\right )}{\sqrt{a^2-b^2}}+8 a^3 (a B-A b) \sin (3 (c+d x))+3 a^4 A \sin (4 (c+d x))}{96 a^5 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.108, size = 1212, normalized size = 5.1 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 0.669333, size = 1504, normalized size = 6.27 \begin{align*} \left [\frac{3 \,{\left (3 \, A a^{6} - 4 \, B a^{5} b + A a^{4} b^{2} - 4 \, B a^{3} b^{3} + 4 \, A a^{2} b^{4} + 8 \, B a b^{5} - 8 \, A b^{6}\right )} d x - 12 \,{\left (B a b^{4} - A b^{5}\right )} \sqrt{a^{2} - b^{2}} \log \left (\frac{2 \, a b \cos \left (d x + c\right ) -{\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt{a^{2} - b^{2}}{\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) +{\left (16 \, B a^{6} - 16 \, A a^{5} b + 8 \, B a^{4} b^{2} - 8 \, A a^{3} b^{3} - 24 \, B a^{2} b^{4} + 24 \, A a b^{5} + 6 \,{\left (A a^{6} - A a^{4} b^{2}\right )} \cos \left (d x + c\right )^{3} + 8 \,{\left (B a^{6} - A a^{5} b - B a^{4} b^{2} + A a^{3} b^{3}\right )} \cos \left (d x + c\right )^{2} + 3 \,{\left (3 \, A a^{6} - 4 \, B a^{5} b + A a^{4} b^{2} + 4 \, B a^{3} b^{3} - 4 \, A a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \,{\left (a^{7} - a^{5} b^{2}\right )} d}, \frac{3 \,{\left (3 \, A a^{6} - 4 \, B a^{5} b + A a^{4} b^{2} - 4 \, B a^{3} b^{3} + 4 \, A a^{2} b^{4} + 8 \, B a b^{5} - 8 \, A b^{6}\right )} d x + 24 \,{\left (B a b^{4} - A b^{5}\right )} \sqrt{-a^{2} + b^{2}} \arctan \left (-\frac{\sqrt{-a^{2} + b^{2}}{\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) +{\left (16 \, B a^{6} - 16 \, A a^{5} b + 8 \, B a^{4} b^{2} - 8 \, A a^{3} b^{3} - 24 \, B a^{2} b^{4} + 24 \, A a b^{5} + 6 \,{\left (A a^{6} - A a^{4} b^{2}\right )} \cos \left (d x + c\right )^{3} + 8 \,{\left (B a^{6} - A a^{5} b - B a^{4} b^{2} + A a^{3} b^{3}\right )} \cos \left (d x + c\right )^{2} + 3 \,{\left (3 \, A a^{6} - 4 \, B a^{5} b + A a^{4} b^{2} + 4 \, B a^{3} b^{3} - 4 \, A a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \,{\left (a^{7} - a^{5} b^{2}\right )} d}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.20034, size = 867, normalized size = 3.61 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]